package com.qian.fmall.portal;

import com.qian.fmall.commons.ResultSet;
import com.qian.fmall.pojo.Category;
import com.qian.fmall.product.service.ProductService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@CrossOrigin
@RequestMapping("product")
public class ProductController {
    @DubboReference
    private ProductService productService;
    //推荐商品
    @RequestMapping("list")
    public ResultSet getAllNewProduct(){
        return productService.getNewProducts();
    }
    //三级分类
    @RequestMapping("categoryType")
    public ResultSet getCategory()
    {
        return productService.findCategory();
    }
    //商品分类展示
    @RequestMapping("categoryProduct")
    public ResultSet getCategoryProduct()
    {
         List<Category> category = productService.getCategoryMenu();
        return ResultSet.ok("success",category);
    }
}
